

wget https://pic.tltr.top/hadoop-2.7.3.tar.gz
wget https://pic.tltr.top/apache-hive-2.1.1-bin.tar.gz
wget https://pic.tltr.top/zookeeper-3.4.10.tar.gz
wget https://pic.tltr.top/mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz
wget https://pic.tltr.top/mysql-connector-java-5.1.47-bin.jar
wget https://pic.tltr.top/jdk-8u171-linux-x64.tar.gz

export HOST2=172.31.255.250
export HOST3=172.31.255.248

ssh $HOST2 "mkdir -p /root/softwares"
scp softwares/* $HOST2:/root/softwares

mkdir -p /usr/java /usr/hadoop /usr/hive /usr/mysql /usr/zookeeper
tar -zxvf /root/softwares/hadoop-2.7.3.tar.gz -C /usr/hadoop
tar -zxvf /root/softwares/jdk-8u171-linux-x64.tar.gz -C /usr/java
tar -zxvf /root/softwares/zookeeper-3.4.10.tar.gz -C /usr/zookeeper
tar -zxvf /root/softwares/mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz -C /usr/mysql
tar -zxvf /root/softwares/apache-hive-2.1.1-bin.tar.gz -C /usr/hive

echo "export JAVA_HOME=/usr/java/jdk1.8.0_171" >> /etc/profile
echo "export HADOOP_HOME=/usr/hadoop/hadoop-2.7.3" >> /etc/profile
echo "export ZOOKEEPER_HOME=/usr/zookeeper/zookeeper-3.4.10" >> /etc/profile
echo "export HIVE_HOME=/usr/hive/apache-hive.2.1.1-bin" >> /etc/profile

echo "export PATH=$PATH:\$JAVA_HOME/bin:\$HADOOP_HOME/bin:\$ZOOKEEPER_HOME/bin:\$HIVE_HOME/bin"  >> /etc/profile
source /etc/profile


cd /usr/hadoop/hadoop-2.7.3/etc/hadoop
wget https://gitee.com/yushunliee/bigdata/raw/master/core-site.xml
wget https://gitee.com/yushunliee/bigdata/raw/master/hdfs-site.xml
wget https://gitee.com/yushunliee/bigdata/raw/master/yarn-site.xml
wget https://gitee.com/yushunliee/bigdata/raw/master/mapred-site.xml
echo "172.31.255.250" >> slaves
echo "172.31.255.248" >> slaves
echo "export JAVA_HOME=/usr/java/jdk1.8.0_171" >> hadoop-env.sh
echo "export JAVA_HOME=/usr/java/jdk1.8.0_171" >> yarn-env.sh

scp -r /usr/hadoop root@172.31.255.250:/usr/
scp -r /usr/java root@172.31.255.250:/usr/
scp -r /etc/profile root@172.31.255.250:/etc/profile
ssh 172.31.255.250
source /etc/profile
exit
scp -r /usr/hadoop root@172.31.255.248:/usr/
scp -r /usr/java root@172.31.255.248:/usr/
scp -r /etc/profile root@172.31.255.248:/etc/profile
ssh 172.31.255.248
source /etc/profile
exit

cd /usr/hadoop/hadoop-2.7.3
hadoop namenode -format
sbin/start-all.sh

ssh $HOST2 "ls -l"